const state = () => ({
  //整机售卖信息
  sell_info: {
    confirm_price: 0,
    price: null,
    product_service: null,
    gifts: [],
  },
  //整机租聘信息
  rent_info: {
    rent_offer_driver: 0,
    rent_hour_price: null,
    rent_day_price: null,
    rent_month_price: null,
    price_unit: 1,
    rent_dicker: 0,
    rent_driver_info: null,
  },
  sku_data: [], //多规信息
  parameters: [], //核心参数
})

const getters = {
  sell_info: (state) => state.sell_info,
  rent_info: (state) => state.rent_info,
  sku_data: (state) => state.sku_data,
  parameters: (state) => state.parameters,
}

const mutations = {
  setSellInfo(state, obj) {
    state.sell_info = obj
  },
  setRentInfo(state, obj) {
    state.rent_info = obj
  },
  setSkuData(state, arr) {
    state.sku_data = arr
  },
  setParameters(state, arr) {
    state.parameters = arr
  },
}

const actions = {
  setSellInfo({ commit }, info) {
    commit('setSellInfo', info)
  },
  setRentInfo({ commit }, info) {
    commit('setRentInfo', info)
  },
  setSkuData({ commit }, info) {
    commit('setSkuData', info)
  },
  setParameters({ commit }, info) {
    commit('setParameters', info)
  },
}

export default { state, getters, mutations, actions }